package com.test;

import org.junit.Test;

public class ResTest2 {
    public static void main(String[] args) {
        test2();
    }


    /**
     * 替换datatime=???
     */
    public static void test() {
        String str="time=1&datatime=2020-05-12&group=2";
        System.out.println(str.replaceFirst("datatime=(.{10})", "datatime=666"));
    }

    /**
     * 打印pagesize的12和1
     */
    public static void test2() {
        String str="time=1&pagesize=12&group=2";
        String str2="time=1&pagesize=1&group=2";
        int index = str.indexOf("pagesize=") + "pagesize=".length();
        String substring = str.substring(index);
        int length = substring.indexOf("&");

        System.out.println(str.substring(index,index+length));
//        str.substring(str.indexOf("pagesize="),str.lastIndexOf())
    }
}
